﻿using System;
using System.Data;

namespace Dapper.Core
{
    public interface IUnitOfWork : IDisposable
    {
        /// <summary>
        /// 数据库类型
        /// </summary>
        DatabaseType DbType { get; }

        /// <summary>
        /// 数据库连接对象
        /// </summary>
        IDbConnection Connection { get; }

        /// <summary>
        /// 数据库事务对象
        /// </summary>
        IDbTransaction Transaction { get; }

        /// <summary>
        /// 开启事务
        /// </summary>
        void Begin();

        /// <summary>
        /// 提交事务
        /// </summary>
        void Commit();

        /// <summary>
        /// 回滚事务
        /// </summary>
        void Rollback();
    }
}
